# -*- coding: UTF-8 -*-
# https://desktop.arcgis.com/zh-cn/arcmap/latest/analyze/arcpy-functions/clearenvironment.htm
import arcpy
arcpy.env.workspace = "E:/Work2025/CAEP资料/Ydh"
# prints E:/Work2025/CAEP资料/Ydh
print(arcpy.env.workspace)
arcpy.ClearEnvironment("workspace")
# prints None
print(arcpy.env.workspace)

# 返回指定的系统环境变量值。
# Set the scratchWorkspace environment to the value returned
# from the system environment variable TEMP
arcpy.env.scratchWorkspace = arcpy.GetSystemEnvironment("TEMP")

# 列出环境变量名称和当前值。
environments = arcpy.ListEnvironments()
# Sort the environment names
environments.sort()
for environment in environments:
    # Format and print each environment and its current setting.
    # (The environments are accessed by key from arcpy.env.)
    print("{0:<30}: {1}".format(environment, arcpy.env[environment]))